package chapter06.Example01;

import java.util.ArrayList;

/**
 * ArrayList
 */
public class Example01 {
    public static void main(String[] args) {
        ArrayList list = new ArrayList();
        list.add("张战泽");//向列表中添加String对象
        list.add("吕文右");
        list.add("黄岩松");
        list.add("廖元合");
        System.out.println("list元素个数"+list.size());
        System.out.println("查看第二个元素"+list.get(1));
        System.out.println(list);
        list.set(2,"隔壁新强");//替换指定元素
        System.out.println(list);
        list.remove(2);
        System.out.println(list);
        list.add(Math.PI);//列表中放入其他元素
        System.out.println(list);
    }
}
